#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn],b[maxn],ans,n,anslst,lst,sum,p;
template <typename T>
inline void read(T & num)
{
    T f = 1,x = 0;
    char s = getchar();
    for (; s < '0' || s > '9' ; s = getchar())
    {
        if (s == '-')
        {
            f = -f;
        }
    }
    for (; s >= '0' && s <= '9' ; s = getchar())
    {
        x = (x << 3) + (x << 1) + (s ^ '0');
    }
    num = x * f;
}
template <typename T>
inline void print(T x)
{
    if (x < 0)
    {
        x = -x;
    }
    if (x > 10)
    {
        print(x / 10);
    }
    putchar(x % 10 + '0');
}
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    memset(b,0,sizeof(b));
    read(n);
    ans = n;
    sum = 0;
    lst = 0;
    for (register int i = 1 ; i <= n ; i++)
    {
        read(a[i]);
        b[a[i]]++;
    }
    anslst = 0;
    for (register int i = 1 ; i <= 100000 ; i++)
    {
        if (b[i] != 0)
        {
            if (lst == 0)
            {
                lst = i;
                anslst = b[i];
                continue;
            }
            if (anslst >= b[i])
            {
                anslst -= b[i];
                sum += b[i];
                ans -= b[i];
                continue;
            }
            else if (anslst > 0)
            {
                p = sum + anslst;
                if (p > b[i])
                {
                    ans -= b[i];
                    sum = sum + anslst - (b[i] - anslst);
                    anslst = 0;
                }
                else
                {
                    ans -= p;
                    sum = anslst;
                    anslst = b[i] - p;
                }
            }
            else
            {
                p = min(sum,b[i]);
                sum += p;
                ans -= p;
            }
        }
    }
    print(ans);
    return 0;
}
